Ext.ns('AIR2.Import.Resolve');
/***************
 * Import Resolver SrcEmail Panel
 *
 * A panel that allows conflict resolution of SrcEmail
 *
 * @param {Object} data
 * @param {String} model
 * @param {Integer} conWith
 */
AIR2.Import.Resolve.SrcEmail = function(data, model, conWith) {
    // get the resource URL for the emails
    var emailUrl = null;
    var ops = 'ADD|IGNORE';
    if (data.src_uuid) {
        emailUrl = AIR2.HOMEURL + '/source/' + data.src_uuid + '/email';
        if (conWith) {
            emailUrl += '/'+conWith; //conflict with specific email
            ops += '|REPLACE';
        }
        emailUrl += '.json';
    }

    return new AIR2.Import.Resolve.ConflictRow({
        model: model,
        tpl: new Ext.XTemplate(
            '<ul><tpl for=".">' +
                '<tpl if="sem_primary_flag"><li class="sem_primary_flag"><b>Primary:</b> {[AIR2.Format.bool(values.sem_primary_flag)]}</li></tpl>' +
                '<tpl if="sem_context"><li class="sem_context"><b>Type:</b> {sem_context}</li></tpl>' +
                '<tpl if="sem_email"><li class="sem_email"><b>Email:</b> {sem_email}</li></tpl>' +
                '<tpl if="sem_effective_date"><li class="sem_effective_date"><b>Effective:</b> {[AIR2.Format.date(values.sem_effective_date)]}</li></tpl>' +
                '<tpl if="sem_expire_date"><li class="sem_expire_date"><b>Expires:</b> {[AIR2.Format.date(values.sem_expire_date)]}</li></tpl>' +
            '</tpl></ul>',
            {compiled:true, disableFormats:true}
        ),
        currUrl: emailUrl,
        currEmptyText: 'No Email Addresses',
        newData: data,
        validOps: ops
    });
}